package system1

import (
	v1 "github.com/flipped-aurora/gin-vue-admin/server/api/v1"
	"github.com/flipped-aurora/gin-vue-admin/server/middleware"
	"github.com/gin-gonic/gin"
)

type WorkflowDataRouter struct {
}

// InitWorkflowDataRouter 初始化 审批数据 路由信息
func (s *WorkflowDataRouter) InitWorkflowDataRouter(Router *gin.RouterGroup) {
	WorkflowDataRouter := Router.Group("WorkflowData").Use(middleware.OperationRecord())
	WorkflowDataRouterWithoutRecord := Router.Group("WorkflowData")
	var WorkflowDataApi = v1.ApiGroupApp.System1ApiGroup.WorkflowDataApi
	{
		WorkflowDataRouter.POST("createWorkflowData", WorkflowDataApi.CreateWorkflowData)             // 新建审批数据
		WorkflowDataRouter.DELETE("deleteWorkflowData", WorkflowDataApi.DeleteWorkflowData)           // 删除审批数据
		WorkflowDataRouter.DELETE("deleteWorkflowDataByIds", WorkflowDataApi.DeleteWorkflowDataByIds) // 批量删除审批数据
		WorkflowDataRouter.PUT("updateWorkflowData", WorkflowDataApi.UpdateWorkflowData)              // 更新审批数据
	}
	{
		WorkflowDataRouterWithoutRecord.GET("findWorkflowData", WorkflowDataApi.FindWorkflowData)       // 根据ID获取审批数据
		WorkflowDataRouterWithoutRecord.GET("getWorkflowDataList", WorkflowDataApi.GetWorkflowDataList) // 获取审批数据列表
	}
	WorkflowDataRouterWithoutRecord.GET("getDepartments", WorkflowDataApi.GetDepartments) // 用parentId查询部门信息
	WorkflowDataRouterWithoutRecord.GET("getCurrOwners", WorkflowDataApi.GetCurrOwners)   // 用workflow_data_id查询当前审批人

	WorkflowDataRouterWithoutRecord.POST("updateCurrOwners", WorkflowDataApi.UpdateCurrOwners)   // 更新当前处理人
	WorkflowDataRouterWithoutRecord.POST("createApplication", WorkflowDataApi.CreateApplication) // 提交审批申请

	WorkflowDataRouterWithoutRecord.POST("approve", WorkflowDataApi.Approve) // 通过审批
	WorkflowDataRouterWithoutRecord.POST("reject", WorkflowDataApi.Reject)   // 驳回审批
}
